// 引入mongoose
const { default: mongoose } = require("mongoose");

// 导入app
const {app}=require('../../app')

// 创建对象规则
const AsidesSchema=new mongoose.Schema({
    id:String,
    icon:String,
    name:String,
    path:String
})

// 创建对象模型
const AsidesList=mongoose.model('asideslists',AsidesSchema)

app.post('/sy/addAsideslist',(req,res)=>{
    console.log(req.body)
    AsidesList.create(req.body).then(r=>{
        res.send(r)
    })
})
app.get('/sy/getAsideslist',(req,res)=>{
    console.log(req.query)
    AsidesList.find().then(r=>{
        res.send(r)

    })
})


// 导出
module.exports={
    AsidesList
}